#pragma once

#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>

namespace ConnectionBroker
{
   typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> SslSocket_t;
   typedef boost::asio::buffered_stream<boost::asio::ip::tcp::socket> NonSslSocket_t;
   class Socket
   {
      public: //Abstract Interface
         virtual boost::asio::ip::tcp::socket& get() = 0;
   };

   class SslSocket : public Socket, public SslSocket_t
   {
      public: //Constructors, destructor
         SslSocket(boost::asio::io_service& pIoService, boost::asio::ssl::context& pSslContext) :
            SslSocket_t(pIoService, pSslContext) {}
            
      public: //Required Overrides
         virtual boost::asio::ip::tcp::socket& get()
         {
            std::cout << "ssl socket get" << std::endl;
            return next_layer();
         }
   };

   class NonSslSocket : public Socket, public NonSslSocket_t
   {

      public: //Constructors, destructor
         NonSslSocket(boost::asio::io_service& pIoService) :
            NonSslSocket_t(pIoService) {}
            
      public: //Required Overrides
         virtual boost::asio::ip::tcp::socket& get()
         {
            std::cout << "non ssl socket get" << std::endl;
            return next_layer();
         }
   };
}

